unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, RzEdit, ExtCtrls, RzPanel, RzButton,Interface4xzpayService,
  InvokeRegistry, Rio, SOAPHTTPClient, Mask, ComCtrls, RzDTP, RzRadChk,Dialog_View,
  DateUtils;

type
  TForm1 = class(TDialogView)
    Tool_1: TRzToolbar;
    Memo_1: TRzMemo;
    HTTPRIO1: THTTPRIO;
    Panl_1: TPanel;
    Edit_Addr: TRzEdit;
    Edit_Port: TRzEdit;
    Labl_1: TLabel;
    Labl_2: TLabel;
    Btnx_2: TRzToolButton;
    Btnx_1: TRzToolButton;
    Panl_2: TPanel;
    Edit_Unit: TRzEdit;
    Labl_3: TLabel;
    Labl_4: TLabel;
    Edit_KJQJ: TRzEdit;
    Labl_5: TLabel;
    Date_Stax: TRzDateTimePicker;
    Date_Endx: TRzDateTimePicker;
    Btnx_Quit: TRzToolButton;
    Line_1: TRzSpacer;
    Btnx_4: TRzToolButton;
    Line_2: TRzSpacer;
    Chkb_WSDL: TRzCheckBox;
    Chkb_Location: TRzCheckBox;
    Chkb_AddrNull: TRzCheckBox;
    procedure Btnx_1Click(Sender: TObject);
    procedure Btnx_2Click(Sender: TObject);
    procedure Btnx_QuitClick(Sender: TObject);
    procedure Btnx_4Click(Sender: TObject);
  private
  protected
    procedure SetInitialize;override;
    procedure SetCommParams;override;
    procedure SetGridParams;override;
    procedure SetComboItems;override;
    procedure TryFreeAndNil;override;
  public
    function  ExptLink:string;
  end;

var
  Form1: TForm1;

implementation

uses
  Class_KzDebug;

{$R *.dfm}

procedure TForm1.Btnx_1Click(Sender: TObject);
var
  A:Interface4xzWebService;
  B:WideString;

  UnitLink:string;
  KJNDKJQJ:string;
  StaxTime:string;
  EndxTime:string;
begin
  try
    A:=HTTPRIO1 as Interface4xzWebService;
    //A:=GetInterface4xzWebService(True,)
    UnitLink:=Trim(Edit_Unit.Text);
    KJNDKJQJ:=Trim(Edit_KJQJ.Text);
    StaxTime:=FormatDateTime('YYYY-MM-DD',Date_Stax.Date);
    EndxTime:=FormatDateTime('YYYY-MM-DD',Date_Endx.Date);
    //B := A.getinfo('010001','2014-01-01','2014-12-28','0');
    B:=A.getinfo(UnitLink,StaxTime,EndxTime,KJNDKJQJ);
    Memo_1.Lines.Add(B);
    KzDebug.FileLog(B);
  except
    on E:Exception do
    begin
      raise Exception.CreateFmt('%S',[E.Message]);
    end;
  end;
end;

procedure TForm1.Btnx_2Click(Sender: TObject);
var
  Addr:string;
  Port:string;
  Link:string;
begin
  Addr:=Trim(Edit_Addr.Text);
  Port:=Trim(Edit_Port.Text);
  Link:='http://%S:%S/systemframe/services/Interface4xzpayService?wsdl';
  Link:=Format(Link,[Addr,Port]);
  if Chkb_Location.Checked then
  begin
    HTTPRIO1.WSDLLocation:=Link;
  end else
  begin
    HTTPRIO1.URL:=Link;
  end;
  //HTTPRIO1.WSDLLocation:=Link;
  Memo_1.Lines.Add(Link);
end;

procedure TForm1.Btnx_QuitClick(Sender: TObject);
begin
  Application.Terminate;
end;

function TForm1.ExptLink: string;
var
  Addr:string;
  Port:string;
begin
  Addr:=Trim(Edit_Addr.Text);
  Port:=Trim(Edit_Port.Text);
  
  Result:='http://%S:%S/systemframe/services/Interface4xzpayService?wsdl';
  Result:=Format(Result,[Addr,Port]);
end;

procedure TForm1.Btnx_4Click(Sender: TObject);
var
  A:Interface4xzWebService;
  B:WideString;

  UnitLink:string;
  KJNDKJQJ:string;
  StaxTime:string;
  EndxTime:string;
begin
  try
    //A:=HTTPRIO1 as Interface4xzWebService;
    if Chkb_AddrNull.Checked then
    begin
      A:=GetInterface4xzWebService(Chkb_WSDL.Checked,'',nil);
    end else
    begin
      A:=GetInterface4xzWebService(Chkb_WSDL.Checked,ExptLink,nil);
    end;

    UnitLink:=Trim(Edit_Unit.Text);
    KJNDKJQJ:=Trim(Edit_KJQJ.Text);
    StaxTime:=FormatDateTime('YYYY-MM-DD',Date_Stax.Date);
    EndxTime:=FormatDateTime('YYYY-MM-DD',Date_Endx.Date);
    //B := A.getinfo('010001','2014-01-01','2014-12-28','0');
    B:=A.getinfo(UnitLink,StaxTime,EndxTime,KJNDKJQJ);
    Memo_1.Lines.Add(B);
    KzDebug.FileLog(B);
  except
    on E:Exception do
    begin
      raise Exception.CreateFmt('%S',[E.Message]);
    end;
  end;
end;

procedure TForm1.SetComboItems;
begin
  inherited;
  Date_Stax.Date:=StartOfTheMonth(Now);
  Date_Endx.Date:=EndOfTheMonth(Now);
end;

procedure TForm1.SetCommParams;
begin
  inherited;

end;

procedure TForm1.SetGridParams;
begin
  inherited;

end;

procedure TForm1.SetInitialize;
begin
  inherited;

end;

procedure TForm1.TryFreeAndNil;
begin
  inherited;

end;

end.
